package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.CompanyAddDTO;
import org.jsola.hr.dto.CompanyUpdateDTO;
import org.jsola.hr.entity.CompanyDO;
import org.jsola.hr.query.CompanyQuery;
import org.jsola.hr.vo.CompanyImportExcelVO;
import org.jsola.hr.vo.CompanyListVO;
import org.jsola.hr.vo.CompanyVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 用工单位
 *
 * @author zhr
 */
@Api(tags = "hr-用工单位")
public interface ICompanyControllerAPI {

    /**
     * 招聘模块同步用工单位
     * @param companyIds 用工单位ids
     * @return Integer
     */
    @ApiOperation(value = "招聘模块同步用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyIds", dataType = "String[]", value = "用工单位id数组", paramType = "body" ,allowMultiple = true)
    })
    Result<Integer> synchronizationCompanyToRecruit(String[] companyIds);

    /**
     * 新增用工单位
     * @param companyAddDTO 用工单位新增实体
     * @return 用工单位展示对象
     */
    @ApiOperation(value = "新增用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyAddDTO", dataType = "CompanyAddDTO", value = "新增用工单位", paramType = "body")
    })
    Result<CompanyVO> save(CompanyAddDTO companyAddDTO);

    /**
     * 导入excel
     * @param file 上传的文件
     * @param force true忽略错误的行，false有错误中断上传
     * @return 导入成功数量
     */
    @ApiOperation(value = "导入excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file",
                    value = "文件，Content-Type需要设置为multipart/form-data",
                    paramType = "form"),
            @ApiImplicitParam(name = "force", dataType = "Boolean", value = "true忽略错误的行，false有错误中断", paramType = "query")
    })
    Result<CompanyImportExcelVO> importFile(MultipartFile file, Boolean force);


    /**
     * 修改用工单位
     * @param companyUpdateDTO 用工单位
     * @return 更新数量
     */
    @ApiOperation(value = "修改用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyUpdateDTO", dataType = "CompanyUpdateDTO", value = "修改用工单位", paramType = "body")
    })
    Result<Integer> update(CompanyUpdateDTO companyUpdateDTO);




    /**
     * 删除单个用工单位，彻底删除
     * @param companyId 用工单位id
     * @return 删除数量
     */
    @ApiOperation(value="删除单个用工单位，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "用工单位id", paramType = "path")
    })
    Result<Integer> delete(String companyId);


    /**
     * 批量删除用工单位，彻底删除
     * @param companyIds 用工单位id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除用工单位，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyIds", dataType = "String[]", value = "用工单位id数组", paramType = "body" ,allowMultiple = true)
    })
    Result<Integer> deleteBatch(String[] companyIds);


    /**
     * 根据用工单位id查询用工单位详情
     * @param companyId 用工单位id
     * @return 用工单位详情
     */
    @ApiOperation(value="根据用工单位id查询用工单位详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "用工单位id", paramType = "path")
    })
    Result<CompanyVO> findById(String companyId);

    /**
     * 查询招聘没有同步的用工单位
     * @param companyQuery 用工单位查询参数
     * @return page
     */
    @ApiOperation(value="查询招聘没有同步的用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyQuery", dataType = "CompanyQuery", value = "用工单位查询参数", paramType = "query")
    })
    Result<Page<CompanyListVO>> listAllNoSynchronization(CompanyQuery companyQuery);


    /**
     * 查询用工单位
     * @param companyQuery 用工单位查询参数
     * @return page
     */
    @ApiOperation(value="查询用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyQuery", dataType = "CompanyQuery", value = "用工单位查询参数", paramType = "query")
    })
    Result<List<CompanyListVO>> listAll(CompanyQuery companyQuery);


     /**
     * 分页查询用工单位
     * @param companyQuery 用工单位查询参数
     * @return page
     */
    @ApiOperation(value="分页查询用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyQuery", dataType = "CompanyQuery", value = "用工单位查询参数", paramType = "query")
    })
    Result<Page<CompanyListVO>> page(CompanyQuery companyQuery);

    /**
     * 查询站点下所有公司
     * @return 站点下所有公司
     */
    @ApiOperation(value="查询站点下所有公司")
    Result<List<CompanyDO>> selectBySiteId();

    /**
     * 查询站点下的所有用工单位
     *
     * @param siteId 站点
     * @return 用工单位
     */
    @ApiOperation(value="查询站点下所有公司")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "siteId", dataType = "String", value = "站点", paramType = "query")
    })
    Result<List<CompanyDO>> listSiteCompany(String siteId);

    /**
     * 根据账单Id查询这个账单所在用工分组下的所有用工单位
     * @param costBillId 账单Id
     * @return 用工单位
     */
    @ApiOperation(value="根据账单Id查询这个账单所在用工分组下的所有用工单位")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "costBillId", dataType = "Long", value = "账单Id", paramType = "query")
    })
    Result<List<CompanyDO>> selectByCostBillId(Long costBillId);

}

